import pandas as pd
import json as json_text


def read_excel():
    # 读取Excel文件
    red_text = pd.read_excel("D:\\program\\GZLims_Demo\\main\\xlsxproject\\实施测试账号.xlsx")

    # 将数据转换为字典
    data = red_text.to_dict()
    print(data)

    # data = {'科室': {0: '理化检验科', 1: '理化检验科', 2: '理化检验科'},
    #         '姓名': {0: '刘利亚', 1: '张权', 2: '刘贵荣'},
    #         '职称': {0: '主任', 1: '科员', 2: '科员'},
    #         '职位': {0: None, 1: '复核人', 2: '建批'},
    #         '账号': {0: 13885173586, 1: 14785517767, 2: 15991987315},
    #         '密码': {0: 'Liujingling-23', 1: 'Gz@1234567', 2: 'LGRyjc@3304ly'}}

    my_data = []

    # 获取需要几条数据
    sun = len(data["账号"])

    # 循环遍历字典，将数据添加到列表中
    for i in range(sun):
        # 定义一个空字典，用于存储每一行的数据
        row_data = {}
        for key in data:
            row_data[key] = data[key][i]
        print(row_data)
        # 将每行数据追加到列表中
        my_data.append(row_data)

    print(my_data)


read_excel()


# 计算器
def calculator():
    a_num = input("请输入第一个数字")
    x = input("请选择运算符：+ - * /")
    b_num = input("请输入第二个数字")
    if x == "+":
        c = int(a_num) + int(b_num)
        print(f"{a_num} {x} {b_num} = {c}")
    elif x == "-":
        c = int(a_num) - int(b_num)
        print(f"{a_num} {x} {b_num} = {c}")
    elif x == "*":
        c = int(a_num) * int(b_num)
        print(f"{a_num} {x} {b_num} = {c}")
    elif x == "/":
        c = int(a_num) / int(b_num)
        print(f"{a_num} {x} {b_num} = {c}")
    else:
        print("输入错误")


def txet_lianxi():
    my_name_data = {"张三", "李四", "王五", "马六"}
    for name in my_name_data:
        print(name)

# txet_lianxi()
# calculator()
